package com.cipe.cmrs.service;

import org.springframework.security.authentication.encoding.PasswordEncoder;
import org.springframework.stereotype.Service;

import com.cipe.cmrs.util.PasswordEncryptionUtil;

@Service("passwordEncoder")
public class CustomPasswordEncoder implements PasswordEncoder {
    public String encodePassword(String rawPass, Object salt) {
        return PasswordEncryptionUtil.getEncryptedPassword(rawPass);
    }

    public boolean isPasswordValid(String encPass, String rawPass, Object salt) {
        return encodePassword(rawPass, salt).equals(encPass);
    }
}
